package com.ghpt.controller;
import com.ghpt.pojo.HeDian;
import com.ghpt.service.HeDianService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
@RestController
@RequestMapping("/hedian")
public class HeDianController {
    private final HeDianService heDianService;

    public HeDianController(HeDianService heDianService) {
        this.heDianService = heDianService;
    }
    @GetMapping("/{id}")
    public HeDian getHeDianById(@PathVariable Long id) {
        System.out.println("结果是"+heDianService.findHeDianById(id));
        return heDianService.findHeDianById(id);
    }
    @PutMapping
    public int updateHeDian(@RequestBody HeDian heDian) {
        return heDianService.updateById(heDian);
    }
}
